
#ifndef _MEMBER_BGRIDLAYOUT_H_
#define _MEMBER_BGRIDLAYOUT_H_

#include <BTable>
#include <BWidget>
#include <BGridLayout>
#include "member_BLayout.h"

#define gridlayout_member(gridlayout)		((member_BGridLayout*)((BGridLayout*)gridlayout)->_ptr)

namespace BWE
{
	class GridCell
	{
	public:
		GridCell()
		{
			init();
			fixedStretch = 0.0f;
		}
		void init()
		{
			ignored = true;
			finished = false;
			stretch = 0;
			policy = Policy_None;
			width = 0;
			height = 0;
			fixedSize = BSize();
			sizeHint = BSize();
			minSize = BSize();
			maxSize = BSize();
		}
		bool		ignored;
		bool		finished;
		float		stretch;
		Policy		policy;
		float		fixedStretch;
		int			width;
		int			height;
		BSize		fixedSize;
		BSize		sizeHint;
		BSize		minSize;
		BSize		maxSize;
	};

	class member_BGridLayout
	{
	public:
		member_BGridLayout(BGridLayout* layout);
		~member_BGridLayout();

		void expandTable(int row, int column);
		void prepareCells();
		void distributeWidth(int remainWidth);
		void distributeHeight(int remainHeight);

	public:
		BGridLayout*		boss;
		BArray<GridCell>	rows;
		BArray<GridCell>	cols;
		BTable<LayoutItem>	items;
	};
}

#endif
